package me.tuyou.es.jest.controller;

import me.tuyou.es.jest.dto.Hotel;
import me.tuyou.es.jest.service.EsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class TestController {

    @Autowired
    private EsService esService;

    @RequestMapping(value = "/test")
    public String getRec() {
        List<Hotel> hotelList = esService.getHotelFromTitle("再来");
        return CollectionUtils.isEmpty(hotelList) ? "no data" : hotelList.toString();
    }
}
